package com.dayaokeji.rhythmschoolstudent.client.home.course.ranking.adapter;


import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dayaokeji.rhythmschoolstudent.R;
import com.dayaokeji.rhythmschoolstudent.client.common.base.common.ApiConstantKt;
import com.dayaokeji.rhythmschoolstudent.glide.GlideUrlModel;
import com.dayaokeji.rhythmschoolstudent.glide.GlideUtils;
import com.dayaokeji.server_api.domain.CourseScoringRank;


/**
 * ********************************************************************
 * *  Created by Fei wo on 2018-12-3
 * ********************************************************************
 * *  version 1.0
 * ********************************************************************
 * *  Copyright (C) dayaokeji.com 2018 -- 2020 All rights reserved.
 * ********************************************************************
 * * course scoring ranking adapter
 * ********************************************************************
 */
public class CourseScoringRankingAdapter extends BaseQuickAdapter<CourseScoringRank,BaseViewHolder> {

    public CourseScoringRankingAdapter() {
        super(R.layout.item_course_scoring_ranking);
    }

    @Override
    protected void convert(BaseViewHolder helper, CourseScoringRank item) {
        String score = item.getScore() == null ? "--" : String.valueOf(item.getScore());
        String rank = item.getRank() == null ? "" : String.valueOf(item.getRank());
        helper.setText(R.id.tv_ranking, rank)
                .setText(R.id.tv_user_name, item.getUserName())
                .setText(R.id.tv_college,item.getFacultyName())
                .setText(R.id.tv_course_score, score);
        GlideUtils.with(mContext,true).load(new GlideUrlModel(ApiConstantKt.getRemoteImageUrl()+item.getResourceId())).into((ImageView) helper.getView(R.id.iv_user_avatar));
    }
}
